import { render, createVNode } from "vue";
import { BaseTooltip } from "@antv/s2";
import TooltipContent from '../components/TooltipContent'
import "@antv/s2/dist/style.min.css";

class CustomTooltip extends BaseTooltip {
    constructor(spreadsheet) {
        super(spreadsheet);
    }

    renderContent() {
        const cell = this.spreadsheet.getCell(this.options.event?.target);
        const meta = cell?.getMeta();
        // 使用 Vue 提供的 `createVNode` 方法将组件渲染成虚拟 DOM
        const tooltipVNode = createVNode(TooltipContent, { meta });
        // 使用  `render` 函数将其挂载在 tooltip 容器上
        render(tooltipVNode, this.container);
    }
}
export default CustomTooltip;